var $,layer,form,table,laydate,upload;
layui.use(['jquery','layer','form','table','laydate','upload'],function(){
    $ = layui.$,layer = layui.layer,form = layui.form,table = layui.table,laydate = layui.laydate,upload = layui.upload;
});

//获取父页面用户id
var userId = parent.$('#userId').val();
$.ajax({
    url: '/user/getUsers'
    ,data: {'userId': userId}
    ,dataType: 'json'
    ,success:function(data){
        var user = data.data[0];
        console.log(user);
        $('input[name=account]').val(user.account);
        $('input[name=nickname]').val(user.nickname);
        $('input[name=userCode]').val(user.userCode);
        $('input[name=studyDate]').val(user.studyDate);
        $('input[name=idCard]').val(user.idCard);
        $('input[name=phone]').val(user.phone);
        $('input[name=birthDate]').val(user.birthDate);
        $('input[name=email]').val(user.email);
        $('textarea[name=freestyle]').val(user.freestyle);
        $('textarea[name=remarks]').val(user.remarks);
        $('#avatarUrl').attr('src',user.avatarUrl);
        if(user.sex == 1){
            $('input[name=sex]').val('男');
        }else if(user.sex == 2){
            $('input[name=sex]').val('女');
        }else{
            $('input[name=sex]').val('数据错误');
        }
    }
});

//确定
ascertain = function ascertain(){
    var layer = parent.layer;
    layer.close(layer.index);
}
//取消
cancel = function cancel(){
    var layer = parent.layer;
    layer.close(layer.index);
}